package com.janushuang.algorithm.sorter;

/**
 * @author zhijing.huang
 *         Created by zhijing.huang on 2014/9/26.
 */
public abstract class Sorter<E extends Comparable<E>> {
    public abstract void sort(E[] data, int from, int len);

    public final void sort(E[] data) {
        sort(data, 0, data.length - 1);
    }

    protected final void swap(E[] data, int pos1, int pos2) {
        E temp = data[pos1];
        data[pos1] = data[pos2];
        data[pos2] = temp;
    }
}
